package com.ruoyi.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.system.domain.SysDcarbrandClassifyConfig;
import com.ruoyi.system.service.ISysDcarbrandClassifyConfigService;

/**
 * 车辆品牌分类配置 提供者
 * 
 * @author ruoyi
 * @date 2021-09-17
 */
@Api(value = "产品参数配置-车辆品牌")
@RestController
@RequestMapping("sysDcarbrandClassifyConfig")
public class SysDcarbrandClassifyConfigController extends BaseController
{
	
	@Autowired
	private ISysDcarbrandClassifyConfigService sysDcarbrandClassifyConfigService;
	
	/**
	 * 查询${tableComment}
	 */
	@ApiOperation(value = "根据id查询")
	@ApiImplicitParam(name = "id", value = "id", required = true)
	@GetMapping("get/{id}")
	public SysDcarbrandClassifyConfig get(@PathVariable("id") Long id)
	{
		return sysDcarbrandClassifyConfigService.selectSysDcarbrandClassifyConfigById(id);
		
	}

	@ApiOperation(value = "根据车辆品牌查询")
	@ApiImplicitParam(name = "carBrand", value = "carBrand", required = true)
	@GetMapping("getCarBrand/{carBrand}")
	public SysDcarbrandClassifyConfig getCarBrand(@PathVariable("carBrand") String carBrand)
	{
		return sysDcarbrandClassifyConfigService.selectSysDcarbrandClassifyConfigByCarBrand(carBrand);

	}

	
	/**
	 * 查询车辆品牌分类配置列表
	 */
	@ApiOperation(value = "查询车辆品牌分类配置列表")
	@GetMapping("list")
	public R list(SysDcarbrandClassifyConfig sysDcarbrandClassifyConfig)
	{
		startPage();
        return result(sysDcarbrandClassifyConfigService.selectSysDcarbrandClassifyConfigList(sysDcarbrandClassifyConfig));
	}
	
	
	/**
	 * 新增保存车辆品牌分类配置
	 */
	@ApiOperation(value = "新增保存车辆品牌分类配置")
	@PostMapping("save")
	public R addSave(@RequestBody SysDcarbrandClassifyConfig sysDcarbrandClassifyConfig)
	{		
		return toAjax(sysDcarbrandClassifyConfigService.insertSysDcarbrandClassifyConfig(sysDcarbrandClassifyConfig));
	}

	/**
	 * 修改保存车辆品牌分类配置
	 */
	@ApiOperation(value = "修改保存车辆品牌分类配置")
	@PostMapping("update")
	public R editSave(@RequestBody SysDcarbrandClassifyConfig sysDcarbrandClassifyConfig)
	{		
		return toAjax(sysDcarbrandClassifyConfigService.updateSysDcarbrandClassifyConfig(sysDcarbrandClassifyConfig));
	}
	
	/**
	 * 删除${tableComment}
	 */
	@ApiOperation(value = "删除")
	@ApiImplicitParam(name = "ids", value = "ids", required = true)
	@PostMapping("remove")
	public R remove(String ids)
	{		
		return toAjax(sysDcarbrandClassifyConfigService.deleteSysDcarbrandClassifyConfigByIds(ids));
	}
	
}
